package demo1;
//外部类
 class OuterClass2{
    public int data1 = 1;
    private int data2 = 2;
    public static int data3 =3;
    //实例内部类
    class InnerClass2{
        public int data1 = 1111;
        public int data4 = 4;
        private int data5 = 5;
        //常量是在程序编译的时候 就能确定的
        public static final int data6 = 6;
        public  void func1(){
            System.out.println(data1);
           // System.out.println("====="+this.data1);
            System.out.println("===="+OuterClass2.this.data1);

            System.out.println(data2);
            System.out.println(data3);
            System.out.println(data4);
            System.out.println(data5);
            System.out.println(data6);
        }
    }
     public void func() {
       InnerClass2 innerClass2 = new InnerClass2();
         System.out.println(data1);
         System.out.println(data2);
         System.out.println(data3);
         System.out.println(innerClass2.data4);
         System.out.println(innerClass2.data5);
         System.out.println(InnerClass2.data6);
     }
     public static void function(){
        OuterClass2 outerClass2 = new OuterClass2();
         OuterClass2.InnerClass2 innerClass2 = outerClass2.new InnerClass2();
         System.out.println(innerClass2.data4);
         System.out.println(innerClass2.data5);
         System.out.println(InnerClass2.data6);
     }
 }
class OutClass3 {
    public void func() {
        class InnerClass3 {
            public int a = 1;

            public void test() {
                System.out.println("hello!");
            }
        }
        InnerClass3 innerClass3 = new InnerClass3();
        innerClass3.test();
    }
}

interface IA{
     public void func();
}
class AA implements IA{

    @Override
    public void func() {
        System.out.println("hello!");
    }
}
public class Test2 {
    public static void main(String[] args) {
        new IA(){
            @Override
            public void func() {
                System.out.println("hello::");
            }
        }.func();
    }
   /* public static void main2(String[] args) {
        IA ia = new AA();
        ia.func();
    }*/

    public static void main1(String[] args) {
        OutClass3 outClass3 = new OutClass3();
        outClass3.func();
        //OuterClass2 outerClass2 = new OuterClass2();
        //OuterClass2.InnerClass2 innerClass2 =  outerClass2.new InnerClass2();
        //innerClass2.func1();
        //outerClass2.func();

    }
}
